package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppSmsRecord;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * @author anxiang
 * @version 1.0.0
 * @ClassName AppTaskRecordDao.java
 * @Description TODO
 * @createTime 2021年07月26日 12:19:00
 */
@Repository
public class AppSmsRecordDao extends BaseDao<AppSmsRecord> {

    public void saveOrUpdate(AppSmsRecord pojo) {
        if (pojo.getId() == null || pojo.getId() == 0) {
            pojo.setId(this.add(pojo));
        } else {
            this.update(pojo);
        }

    }

    public List<AppSmsRecord> findList(Integer formtxcode, SplitPageBean splitPageBean) {
        List<Object> list = new ArrayList<>();
        StringBuilder str = new StringBuilder("");
        str.append("select * from app_sms_record where 1=1 and to_days(createtime) = to_days(now()) ");
        str.append(" and formtxcode = ? ");
        list.add(formtxcode);
        String sql = str.toString();
        return this.queryList(sql, list, AppSmsRecord.class, splitPageBean);
    }
}